;function Animate(elems) {

  var targetElems = elems.length ? elems: [elems],

      target,

      i,len = targetElems.length,

      first = true,

      queue = Queue(),
      

      _getNewTime = function() {
        return +new Date();
      },

      _getStyle = function(elem,attr) {

        var value = window.getComputedStyle ? getComputedStyle(elem,null)[attr] : 
            elem.currentStyle[attr];

        value = +value.replace(/px|pt/, '');

        if(attr == 'opacity') {
          value *= 100;
        }

        return value;
      },


      animate = function(options,time,callback) {


        time = time || 1000;

        _animate()

        function _animate() {

          var initValue = {};

          var startTime = _getNewTime();

          function task(index) {

            var finished = true;

            var nowTime = _getNewTime();

            var spaceTime = nowTime - startTime;
            

            for(var key in options) {

              var endValue = options[key];

              var anminLength = endValue - initValue[key+index];

              if( spaceTime < time ) {

                finished = false;
                var middValue = initValue[key+index] + (spaceTime/time) * anminLength;
                
                this.style[key] = key != 'opacity'? middValue + 'px' : middValue/100 ;
              }else {
                
                this.style[key] = key != 'opacity'? endValue + 'px' : endValue/100 ;

              }


            }

            if(finished) {

              clearInterval(this.timeId);
              this.timeId = null;

              
            
              

              if( callback ) {
                callback();

              }
            }

            

          }

          for(i=0; i<len; i++) {

            target = targetElems[i];

            for(var key in options) {
              initValue[key+i] = _getStyle(target,key);
            }

            (function(elem,idx) {
               elem.timeId = setInterval(function() {
                task.call(elem,idx);
              } ,1)
            })(target,i)
          }

        }
        return this;
      }
      ;


      
      return {
        animate: animate
      };
      





}